package com.hardson.toolkit.listcomparator;

public class NumberListComparator<T> extends ListComparator<T> {

	public NumberListComparator() {

	}

	@Deprecated
	public NumberListComparator(final String colName, final Class<T> clazz, final int order) {
		this.colName = colName;
		this.cl = clazz;
		this.order = order;
	}

	public NumberListComparator(final String colName, final int order) {
		this.colName = colName;
		this.order = order;
	}

	@Override
	public int compare(final T t1, final T t2) {
		T swapObj[] = this.swap(t1, t2);
		Object val0 = this.getValueObj(swapObj[0]);
		Object val1 = this.getValueObj(swapObj[1]);
		// Integer result = this.compareNull(val0, val1);
		// if (result != null) {
		// return result;
		// }
		Double cmp1 = (val0 == null) ? new Double(0) : new Double(val0.toString());
		Double cmp2 = (val1 == null) ? new Double(0) : new Double(val1.toString());
		return cmp1.compareTo(cmp2);
	}

}